package me.xplabs.view.player 
{
	import flash.display.Bitmap;
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import me.xplabs.Globals;
	import me.xplabs.model.msg.MsgChangeRaidInfo;
	import me.xplabs.ui.baseui.Label;
	import me.xplabs.ui.BaseView;
	import me.xplabs.ui.UICompent;
	
	/**
	 * http://www.xplabs.me/
	 * @author xiaohan
	 */
	public class RaidBaseInfoView extends BaseView
	{
		private var _bgBitmap:Bitmap;
		private var _goldLabel:Label;
		private var _waveLabel:Label;
		private var _lifeBitmap:Bitmap;
		private var _lifeLabel:Label;
		
		private var _waveBitmap:Bitmap;
		public function RaidBaseInfoView(pfather:DisplayObjectContainer)
		{
			super(pfather);
		}
		override protected function init():void 
		{
			super.init();
			//
			//var t:Sprite = new Sprite();
			//addChild(t);
			//UICompent.addListener(t);
			
			_bgBitmap = new Bitmap();
			_bgBitmap.bitmapData = Globals.lib.getResObj(Globals.domain.texture + 29);
			
			_waveBitmap = new Bitmap();
			_waveBitmap.bitmapData = Globals.lib.getResObj(Globals.domain.texture +30);
			_waveBitmap.x = 30;
			_waveBitmap.y = 33;
			//t.addChild(_waveBitmap);
			
			
			
			_goldLabel = Globals.ui.label("0");
			//_goldLabel.color = 0xE0EB1B;
			_goldLabel.color = 0x000000;
			_goldLabel.x = 126;
			_goldLabel.y = 8;
			_goldLabel.mouseChildren = false;
			_goldLabel.mouseEnabled = false;
			//UICompent.addListener(_goldLabel);
			
			_waveLabel = Globals.ui.label("WAVE 0/15");
			//_waveLabel.color = 0xA4A06C;
			_waveLabel.color = 0x000000;
			_waveLabel.x = 65;
			_waveLabel.y = 35;
			_waveLabel.size = 11;
			_waveLabel.mouseChildren = false;
			_waveLabel.mouseEnabled = false;
			//UICompent.addListener(_waveLabel);
			//
			//_lifeBitmap = new Bitmap();
			//_lifeBitmap.bitmapData = Globals.lib.getResObj(Globals.domain.texture + 25);
			//_lifeBitmap.x = 20;
			//_lifeBitmap.y = 9;
			
			_lifeLabel = Globals.ui.label("0");
			//_lifeLabel.color = 0xC6C2A2;
			_lifeLabel.color = 0x000000;
			_lifeLabel.x = 50;
			_lifeLabel.y = 8;
			_lifeLabel.mouseChildren = false;
			_lifeLabel.mouseEnabled = false;
			//UICompent.addListener(_lifeLabel);
			
			addChild(_bgBitmap);
			addChild(_waveBitmap);
			addChild(_goldLabel);
			addChild(_waveLabel);
			//addChild(_lifeBitmap);
			addChild(_lifeLabel);
		}
		
		public function updateGold(gold:int):void
		{
			_goldLabel.text = String(gold);
		}
		public function updateWave(wave:int,totalWave:int):void
		{
			_waveLabel.text = "WAVE " + wave + "/" + totalWave;
		}
		public function updateLife(life:int):void
		{
			_lifeLabel.text = String(life);
		}
		
		public function initRaidInfo(life:int, gold:int, wave:int, totalWave:int):void
		{
			_goldLabel.text = String(gold);
			_waveLabel.text = "WAVE " + wave + "/" + totalWave;
			updateGold(gold);
			updateWave(wave , totalWave);
			updateLife(life);
		}
	}

}